<{include file='public/head'}>
<div class="layui-body">
	<div class="layui-tab layui-tab-brief" lay-filter="tab">
	  <ul class="layui-tab-title">
	    <li class="layui-this" lay-id="t1">栏目列表</li>
	    <li lay-id="t2">栏目新增</li>
	    <li lay-id="t3">批量新增</li>
	  </ul>
	  <div class="layui-tab-content">
	  	   <div class="layui-tab-item layui-show">
	  	   		 <form action="<{:url('/Sorttype/mod')}>" method="post" id="sortForm" name="sortForm">
	  	   		 <input type="hidden" name="formcheck" value="<{$formcheck}>" >
	  	   		 <table class="layui-table" id="sortTable">
	  	   		 	  <thead>
		                    <tr>
		                        <th><input type="checkbox" lay-ignore id="checkall" title="全选"></th>
		                        <th>栏目名称</th>
		                        <th>编码</th>
		                        <th>URL名称</th>
		                        <th>模型</th>
		                        <th>列表页模板</th>
		                        <th>详情页模板</th>
		                        <th>排序</th>
		                        <th>状态</th>
		                        <th>操作</th>
		                    </tr>
		                </thead>
		                <tbody>
						<{volist name="sorts" id="val"}>
		                    <tr data-tt-id='<{$val->scode}>' data-tt-parent-id="<{$val->pcode}>">
		                    	<td>
		                    		<input type="checkbox" class="checkitem" lay-ignore name="list[]" value="<{$val->scode}>">
		                    		<input type="hidden" name="listall[]" value="<{$val->id}>">
		                    	</td>
		                        <td>
		                            <{if condition="$val->son"}>
		                               <i class="fa fa-folder-o" aria-hidden="true"></i>
		                            <{else}>
		                               <i class="fa fa-folder-open-o" aria-hidden="true"></i>
		                            <{/if}>
									<{$val->name}>
									<{if condition="$val->outlink"}>
		                            	<span class="layui-badge layui-bg-black">链</span>
		                            <{/if}>
									<{if condition="$val->lkcode >0"}>
		                            	<span class="layui-badge layui-bg-black">关</span>
		                            <{/if}>
		                        </td>
		                        <td><{$val->scode}></td>
		                        <td><{$val->filename}></td>
		                        <td>
								<{volist name="allmodels" id="val2"}>
		                        	<{if condition="$val2.mcode eq $val->mcode"}>
										<{$val2.name}>
									<{/if}>
				                <{/volist}>
								</td>
		                        <td><{$val->listtpl}></td>
		                        <td><{$val->contenttpl}></td>
		                        <td class="table-input"><input type="text" name="sorting[]" value="<{$val->sorting}>" class="layui-input"></td>
		                       	<td>
		                            <{if condition="$val->status"}>
		                            <a href="<{:url('/Sorttype/mod/scode/'.$val->scode.'/field/status/value/0')}>"><i class='fa fa-toggle-on' title="点击禁用"></i></a>
		                            <{else}>
		                            <a href="<{:url('/Sorttype/mod/scode/'.$val->scode.'/field/status/value/1')}>"><i class='fa fa-toggle-off' title="点击启用"></i></a>
		                            <{/if}>
		                        </td>
		                        <td>
								<{if condition="!$val->outlink"}>
										<{if condition="$val->filename"}>
			                        		<a href="/Index/<{$val->filename}>" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
			                        	<{else}>
			                        		<a href="/Index/<{$val->urlname}>/<{$val->scode}>" class="layui-btn layui-btn-xs layui-btn-primary"  target="_blank">查看</a>
			                        	<{/if}>
		                        	<{/if}>
		                            <{:get_btn_del($val->scode,'Sorttype','scode')}>
		                            <{:get_btn_mod($val->scode,'Sorttype','scode')}>
		                        </td>
		                    </tr>
		                <{/volist}>
		             </tbody>
	  	   		 </table>
	  	   		 <button type="submit" name="submit" value="sorting" class="layui-btn">保存排序</button>
	  	   		 <button type="submit" name="submit" onclick="return setDelAction();" class="layui-btn">批量删除</button>
	  	   		 <script>
		     		function setDelAction(){
		     			document.sortForm.action = "<{:url('/Sorttype/del')}>";
		     			return confirm("您确定要删除选中的栏目么？");
		     		}
		     		$("#sortTable").treetable({ expandable: true,column: 1,indent:20,stringCollapse:'收缩',stringExpand:'展开' });
		     	</script>
	  	   		</form>
	  	    </div>

	  	     <div class="layui-tab-item">
	  	     	<form action="<{:url('/Sorttype/add')}>" method="post" class="layui-form" lay-filter="sort">
		  	     	<input type="hidden" name="formcheck" value="<{$formcheck}>" >
		  	     	<div class="layui-tab">
					  <ul class="layui-tab-title">
					    <li class="layui-this">基本选项</li>
					    <li>高级选项</li>
					  </ul>
					  <div class="layui-tab-content">
					    <div class="layui-tab-item layui-show">
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">父栏目</label>
			                     <div class="layui-input-block">
			                     	<select name="pcode">
				                        <option value="0" >顶级栏目</option>
				                        <{$sort_select}>
				                    </select>
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">栏目名称 <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="name" required lay-verify="required" placeholder="请输入栏目名称" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">URL名称 </label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="filename" placeholder="请输入URL名称，如:test" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">内容模型 <span class="layui-text-red">*</span></label>
			                     <div class="layui-input-block">
			                     	<select name="mcode" lay-filter="model" lay-verify="required" >
				                     	<option value="">请选择内容模型</option>
										<{volist name="$models" id="value"}>
				                        	<option value="<{$value.mcode}>" data-type="<{$value.type}>"  data-listtpl="<{$value.listtpl}>" data-contenttpl="<{$value.contenttpl}>" ><{$value.name}></option>
				                        <{/volist}>
				                    </select>
			                     </div>
			                </div>

			                 <input type="hidden" value="1" name="type" id="type">

			                 <div class="layui-form-item">
			                     <label class="layui-form-label">列表页模板</label>
			                     <div class="layui-input-block">
				                     <select name="listtpl" id="listtpl">
				                     	<option value="">无</option>
										<{volist name="$tpls" id="value"}>
											<option value="<{$value.listtpl}>"><{$value.listtpl}></option>
										<{/volist}>
				                     </select>
			                     </div>
			                </div>

			                 <div class="layui-form-item">
			                     <label class="layui-form-label">详情页模板</label>
			                     <div class="layui-input-block">
				                     <select name="contenttpl" id="contenttpl" >
				                     	<option value="">无</option>
										<{volist name="$tpls" id="value"}>
											<option value="<{$value.contenttpl}>"><{$value.contenttpl}></option>
										<{/volist}>
				                     </select>
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">状态</label>
			                     <div class="layui-input-block">
			                     	<input type="radio" name="status" value="1" title="显示" checked>
									<input type="radio" name="status" value="0" title="隐藏">
			                     </div>
			                </div>
					    </div>
					    <div class="layui-tab-item">
					    	<div class="layui-form-item">
			                     <label class="layui-form-label">栏目副名称</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="subname" placeholder="请输入栏目副名称" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">跳转链接</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="outlink" placeholder="请输入跳转链接" class="layui-input">
			                     </div>
			                </div>

							<div class="layui-form-item">
			                     <label class="layui-form-label">图标</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="faico" placeholder="请输入图标名称" class="layui-input"><a href="http://www.fontawesome.com.cn/faicons/" target="_blank" style="color:red;">[查看图标库]</a>
			                     </div>
			                </div>

			                 <div class="layui-form-item">
			                     <label class="layui-form-label">栏目缩略图</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="ico" id="ico" placeholder="请上传栏目缩略图"  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn upload" data-des="ico">
								 	 <i class="layui-icon">&#xe67c;</i>上传图片
								 </button>
								 <div id="ico_box" class="pic"></div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">栏目大图</label>
			                     <div class="layui-input-inline">
			                     	<input type="text" name="pic" id="pic" placeholder="请上传栏目大图"  class="layui-input">
			                     </div>
			                     <button type="button" class="layui-btn upload" data-des="pic">
								 	 <i class="layui-icon">&#xe67c;</i>上传图片
								 </button>
								 <div id="pic_box" class="pic"></div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO标题</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="title" placeholder="请输入栏目SEO标题，需前端调用" class="layui-input">
			                     </div>
			                </div>

			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO关键字</label>
			                     <div class="layui-input-block">
			                     	<input type="text" name="keywords" placeholder="请输入栏目SEO关键字，需前端调用" class="layui-input">
			                     </div>
			                </div>
			                <div class="layui-form-item">
			                     <label class="layui-form-label">SEO描述</label>
			                     <div class="layui-input-block">
			                     	<textarea name="description" placeholder="请输入栏目SEO描述，需前端调用" class="layui-textarea"></textarea>
			                     </div>
			                </div>
					    </div>
					  </div>
					</div>
					<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button class="layui-btn" lay-submit>立即提交</button>
						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
						 </div>
					</div>
				</form>
	  	     </div>
	  	     <!-- 批量新增 -->
	  	     <div class="layui-tab-item">
	  	     	<form action="<{:url('/Sorttype/add')}>" method="post" class="layui-form" lay-filter="sort">
		  	     		<input type="hidden" name="formcheck" value="<{$formcheck}>" >
		  	     		<div class="layui-form-item">
		                     <label class="layui-form-label">父栏目</label>
		                     <div class="layui-input-block">
		                     	<select name="pcode">
			                        <option value="0" >顶级栏目</option>
			                        <{$sort_select}>
			                    </select>
		                     </div>
		                </div>

		                <div class="layui-form-item">
		                     <label class="layui-form-label">栏目名称</label>
		                     <div class="layui-input-block">
		                     	<input type="text" name="multiplename" required lay-verify="required" placeholder="请输入栏目名称，多个栏目用逗号隔开" class="layui-input">
		                     </div>
		                </div>

		                <div class="layui-form-item">
		                     <label class="layui-form-label">内容模型</label>
		                     <div class="layui-input-block">
		                     	<select name="mcode" lay-filter="model" lay-verify="required" >
			                     	<option value="">请选择内容模型</option>
									<{volist name="$models" id="value"}>
				                        <option value="<{$value.mcode}>" data-type="<{$value.type}>"  data-listtpl="<{$value.listtpl}>" data-contenttpl="<{$value.contenttpl}>" ><{$value.name}></option>
				                    <{/volist}>
			                    </select>
		                     </div>
		                </div>

		                 <input type="hidden" value="1" name="type" id="type">

		                 <div class="layui-form-item">
		                     <label class="layui-form-label">列表页模板</label>
		                     <div class="layui-input-block">
			                     <select name="listtpl" id="listtpl">
			                     	<option value="">无</option>
									<{volist name="$tpls" id="value"}>
									<option value="<{$value.listtpl}>"><{$value.listtpl}></option>
									<{/volist}>
			                     </select>
		                     </div>
		                </div>

		                 <div class="layui-form-item">
		                     <label class="layui-form-label">详情页模板</label>
		                     <div class="layui-input-block">
			                     <select name="contenttpl" id="contenttpl" >
			                     	<option value="">无</option>
									<{volist name="$tpls" id="value"}>
									<option value="<{$value.contenttpl}>"><{$value.contenttpl}></option>
									<{/volist}>
			                     </select>
		                     </div>
		                </div>
		                <div class="layui-form-item">
		                     <label class="layui-form-label">状态</label>
		                     <div class="layui-input-block">
		                     	<input type="radio" name="status" value="1" title="显示" checked>
								<input type="radio" name="status" value="0" title="隐藏">
		                     </div>
		                </div>
					<div class="layui-form-item">
						 <div class="layui-input-block">
						    <button class="layui-btn" lay-submit>立即提交</button>
						    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
						 </div>
					</div>
				</form>
	  	     </div>
	   </div>
	</div>
</div>
<{include file='public/foot'}>
